package com.second.app.thread.reentrant.condition;


/**
 * @author gyz
 * @date 2021/2/3 14:18
 */
public class Run {
    public static void main(String[] args) {

        MyService myService = new MyService();
        Runnable runnable = new Runnable() {

            @Override
            public void run() {
                myService.waitA();
            }
        };
        Runnable runnable1 = new Runnable() {

            @Override
            public void run() {
                myService.waitB();
            }
        };
        Runnable runnable2 = new Runnable() {

            @Override
            public void run() {
                myService.waitC();
            }
        };

        Thread[] aArray = new Thread[5];
        Thread[] bArray = new Thread[5];
        Thread[] cArray = new Thread[5];
        for (int i = 0; i < 5; i++) {
            aArray[i] = new Thread(runnable);
            aArray[i].setName("A");
            bArray[i] = new Thread(runnable1);
            bArray[i].setName("B");
            cArray[i] = new Thread(runnable2);
            cArray[i].setName("C");
            aArray[i].start();
            bArray[i].start();
            cArray[i].start();
        }

    }
}
